#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, a[N], ans, t[N], l, s;
int main(){
    freopen("duel.in", "r", stdin);
    freopen("duel.out", "w", stdout);
    cin >> n;
    ans = n;
    for(int i = 1; i <= n; i++){
        scanf("%d", &a[i]);
    }
    sort(a + 1, a + 1 + n);
    s = 1;
    for(int i = 2; i <= n; i++){
        if(a[i] > a[i - 1]){
            t[++l] = i - s;
            s = i;
        }
    }
    t[++l] = n - s + 1;
    int rest = 0;
    for(int i = 1; i < l; i++){
        if(t[i] + rest <= t[i + 1]){
            ans -= t[i] + rest;
        }else{
            ans -= t[i + 1];
            rest = rest + t[i] - t[i + 1];
        }
    }
    cout << ans << endl;
    return 0;
}
